package com.lc202309;

/**
 * Description:
 *
 * @Create 2023/9/7 23:08
 * @Version 1.0
 */
public class Solution283 {
    public void moveZeroes(int[] nums) {
        int index = nums.length-1;
        int tmp;
        for (int i = 0; i < nums.length; i++) {
            if (nums[i] == 0) {
                index = Math.min(index, i);
                continue;
            }
            if(index==nums.length-1){
                continue;
            }
            tmp = nums[i];
            nums[i] = nums[index];
            nums[index] = tmp;
            index += 1;
        }
    }
}
